<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <script src="jq/jquery-3.1.0.js" charset="utf-8"></script>
  </head>
  <body>
      <div class="a">

      </div>
      <img id="img" src="" alt="" />
  </body>
<script type="text/javascript">
	$.ajax({
		// url:"http://lf.snssdk.com/api/news/feed/v44/?version_code=5.8.2&app_name=news_article&vid=EEA0436D-2748-49B8-B49F-786D21EC6B58&device_id=27439213407&channel=App%20Store&resolution=750*1334&aid=13&ab_version=72359,83096,77081,79287,85688,85046,83772,85442,85626,31211,85409,82678,85230,85795,85653,85016,84555,82763&ab_feature=z2&ab_group=z2&openudid=6a1c962b914ea3793c9f5290cbd37ea3af38a086&live_sdk_version=1.3.0&idfv=EEA0436D-2748-49B8-B49F-786D21EC6B58&ac=WIFI&os_version=10.0.2&ssmix=a&device_platform=iphone&iid=5815459828&ab_client=a1,f2,f7,e1&device_type=iPhone%206&idfa=0CCA7EC1-6CF0-492B-80D5-7F91F4B75C4D&LBS_status=authroize&category=news_local&city=%E8%A5%BF%E5%AE%89&concern_id=6216118362792004098&count=20&cp=5f8b031bC175Eq1&detail=1&image=1&language=zh-Hans-CN&last_refresh_sub_entrance_interval=1476511582&latitude=34.23665054861637&loc_mode=1&loc_time=1476511527&longitude=108.8757361170089&min_behot_time=1476511129&refer=1&strict=0&tt_from=pull",
    url:"http://api.sina.com.cn/weibo/2/users/show.json",
		dataType:'jsonp',
    // result是形参jquery中已经定义这里自己随便起名字
		success:function(result) {
      // console.log(result);
      // 获取到数组result中的data数组
      var objArray = result["data"];
      // console.log(objArray);
      // 通过for 循环遍历数组得到数组中的每个元素
      for (var i = 0; i < objArray.length; i++) {
        // console.log(objArray[i]);
        // 将得到数组中的每个元素并且赋值给object(对象)
        var object = objArray[i];
        console.log(object);
        // 将object对象中的content赋值给json得到json串
        var json = object.content;
        // console.log(json);
        // 解析json串并且赋值给object2
        var object2 = JSON.parse(json);
        console.log(object2);
        // 如果i等于2时页面直接跳转至object2.article_url所指的页面
        if (i==2) {
          // window.location.href = object2.article_url;
        }
      }
		}
	});
</script>

</html>
